using System.Web.Mvc;
using System.Web.Routing;
using NHibernate.Cfg;
using Web.Extensions;

namespace Web
{
	public class WebApplication : NhibernateEnabledApplication
	{
		public override void ConfigureSystem()
		{
			var cfg = Container.Resolve<IDatabaseConfiguration>().DatabaseConfiguration;
			cfg.SetProperty(Environment.CurrentSessionContextClass, "web");
			cfg.SetProperty(Environment.Hbm2ddlKeyWords, "auto-quote");
		}

		protected override void RegisterRoutes(RouteCollection routes)
		{
			routes.MapRoute(
				"Default", // Route name
				"{controller}/{action}/{id}", // URL with parameters
				new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
			);
		}
	}
}